<template>
  <div>
    <div>
      <ul>
        <li>
          <router-link to="/Contacts/Allcontacts">All contacts</router-link>
        </li>
        <li>
          <router-link to="/Contacts/Alice">Alice</router-link>
        </li>
        <li>
          <router-link to="/Contacts/Bob">Bob</router-link>
        </li>
      </ul>

      <button @click="btn(list[parseInt(Math.random() * 3)])">随机显示</button>
      <div>
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: ["/Contacts/Allcontacts", "/Contacts/Alice", "/Contacts/Bob"],
    };
  },
  methods: {
    btn(path) {
      this.$router.push({
        path,
      });
    },
  },
};
</script>

<style>
</style>